package com.ikas.ai.server.module.instance.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ikas.ai.server.config.handler.ListLongHandler;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;
import java.util.Objects;

@Data
@Accessors(chain = true)
@TableName(value = "t_work_instance_step_cost",autoResultMap = true)
public class WorkInstanceStepCost {
    @TableId(type = IdType.ASSIGN_ID)
    Long id;
    @TableField("machine_no")
    String machineNo;
    @TableField("wf_name")
    String wfName;
    @TableField("step_name")
    String stepName;
    @TableField("mete_code")
    String meteCode;
    @TableField(value = "delay_array",typeHandler = ListLongHandler.class)
    List<Long> delayArray;
    @TableField("avg_delay")
    Long avgDelay;
    @TableField("update_time")
    Date updateTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        WorkInstanceStepCost that = (WorkInstanceStepCost) o;
        return Objects.equals(meteCode, that.meteCode) &&
                Objects.equals(stepName, that.stepName) &&
                Objects.equals(wfName, that.wfName) &&
                Objects.equals(machineNo, that.machineNo);
    }

    @Override
    public int hashCode() {
        return Objects.hash(meteCode, stepName, wfName, machineNo);
    }
}
